package main

import "fmt"

func main() {

	i := []int{1, 2, 3, 4, 5, 6, 7}
	fmt.Printf(" a : %v  len : %d  cap : %d \n", i, len(i), cap(i))

	i = remove(i, 3)
	fmt.Printf(" a : %v  len : %d  cap : %d \n", i, len(i), cap(i))

	i = remove2(i, 2)
	fmt.Printf(" a : %v  len : %d  cap : %d \n", i, len(i), cap(i))
}

func remove(z []int, ind int) []int {
	copy(z[ind:], z[ind+1:])
	return z[:len(z)-1]
}

func remove2(z []int, inx int) []int {
	z[inx] = z[len(z)-1]
	return z[:len(z)-1]
}
